<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title>循环嵌套</title>
    </head>
    <body>
        <?php
//        for($j=1;$j<=50;$j++)
//        {
//            for($i=1;$i<=$j;$i++)
//            {
//                echo "&nbsp;";
//            }
//            for($z=1;$z<=50-$j;$z++)
//            {
//                echo "*";
//            }
//            echo "<br/>";
//        }
        $m=9;
        $n=9;
        ?>
        
        <table border="1">
            <tbody>
                <?php
                for($i=1;$i<=$m;$i++)
                {
                ?>
                
                <tr>
                    <?php
                    for($j=1;$j<=$n;$j++)
                    {
                    ?>
                    <td>dss</td> 
                    <?php
                    }
                    ?>
                </tr>
                <?php
                }
                ?>
            </tbody>
        </table>

        <?php
           echo "<table border='1'>";
           for ($i=1;$i<=$m;$i++)
           {
               echo "<tr>";
               for($j=1;$j<=$i;$j++)
               {
                   echo "<td>{$i}*{$j}=".($i*$j);
                   echo "</td>";
               }
               echo "</tr>";
           }
           echo "</table>";
           echo "<hr/>";
        ?>
         <?php
           echo "<table border='1'>";
           for ($i=1;$i<=$m;$i++)
           {
               echo "<tr>";
               for($j=1;$j<=$n;$j++)
               {
                  if ($j<=$i)
                  {
                   echo "<td>{$i}*{$j}=".($i*$j);
                   echo "</td>";
                  }
                  else
                  {
                   echo "<td>";
                   echo "</td>";
                  }
               }
               echo "</tr>";
           }
           echo "</table>";
        ?>
        
    </body>
</html>
